package com.asura.app.library.base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import com.asura.app.library.BaseApplication;

import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Created by Asura on 2017/12/27.
 */

public abstract class BaseActivity extends AppCompatActivity {
    private Unbinder unbinder;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutId());
        unbinder = ButterKnife.bind(this);
        init(savedInstanceState);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        unbinder.unbind();
        BaseApplication.getInstance().getRefWatcher().watch(this);
    }

    protected abstract int getLayoutId();

    protected abstract void init(Bundle savedInstanceState);
}
